<template>
  <el-select
    v-model="modelValue !== undefined && modelValue !== null && modelValue !== ''? modelValue: null"
    @change="(value) => emits('update:modelValue', value)"
    :options="allList"
    :value="valueField"
    :label="labelField"
    :popper-append-to-body="false"
    v-bind="$attrs"
  />
</template>

<script setup>
import * as othersData from "@/data";
import { filterOptions } from "./data.js";
const props = withDefaults(defineProps(), {
  modelValue: null,
  type: undefined,
  valueField: "value",
  labelField: "label",
  dataSourse: undefined,//数据源
});
const emits = defineEmits(["update:modelValue"]);

const { modelValue, dataSourse, type } = toRefs(props);
const inputText = ref("");
const acvTypeVos = computed(() => {
  let obj = {};
  for (let key in othersData) {
    obj[key] = othersData[key].map((item) => ({
      [props.valueField]: item.value,
      [props.labelField]: item.label,
    }));
  }
  obj = {
    ...obj,
    acvTypeVos: undefined,
  };
  return obj;
});
const allList = computed(() => {
  if (Array.isArray(dataSourse.value)) {
    return dataSourse.value;
  }
});
</script>

<style scoped></style>
